var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = cc._decorator,
    s = r.ccclass,
    c = r.property,
    p = (r.menu, r.executeInEditMode),
    l = (function (t) {
        i(e, t);
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            e.animal = null;
            e.scaleNode = null;
            e.effNode = null;
            e.rotateNode = null;
            e.pathName = "devAni02";
            e.psNode = null;
            e.foodId = "";
            e.pathKey = {};
            return e;
        }
        e.prototype.onLoad = function () {
            this.pathKey = {
                1: QLooperNode.tag_devEff01,
                2: QLooperNode.tag_devEff02,
                3: QLooperNode.tag_devEff03,
                4: QLooperNode.tag_devEff04,
                5: QLooperNode.tag_devEff05,
                6: QLooperNode.tag_devEff06
            };
        };
        e.prototype.checkFoodId = function (t) {
            this.foodId = t;
            var e = this.animal;
            if (!e) {
                e = this.node.addComponent(cc.Animation);
                this.animal = e;
            }
            var o = this.pathName;
            this.loadPath(o, function (t, a) {
                e.addClip(a, o);
            });
        };
        e.prototype.loadPath = function (t, e) {
            BundleManager.loadRes(BundleManager.bn.Res, "/map/devAnimal/" + t, cc.AnimationClip, e);
        };
        e.prototype.openCook = function () {
            this.animal.play(this.pathName);
            var t = CacheDataManager.getFoodPsId(this.foodId),
                e = this.pathKey[t];
            if (e && "" != e) {
                if (!this.psNode) {
                    var o = QLooperNode.getNode(e);
                    o.parent = this.effNode;
                    o.setPosition(cc.Vec2.ZERO);
                    this.psNode = o;
                }
                PlayEffectDo.playPs(this.psNode);
            }
        };
        e.prototype.closeCook = function () {
            this.animal.stop(this.pathName);
            if (this.psNode) {
                QLooperNode.putNode(this.psNode);
                this.psNode = null;
            }
        };
        e.prototype.checkKeyNode = function (t) {
            var e = this.node.getChildByName(t);
            e || ((e = new cc.Node(t)).parent = this.node);
            return e;
        };
        n([c(cc.Animation)], e.prototype, "animal", void 0);
        n([c(cc.Node)], e.prototype, "scaleNode", void 0);
        n([c(cc.Node)], e.prototype, "effNode", void 0);
        n([c(cc.Node)], e.prototype, "rotateNode", void 0);
        return n([s, p], e);
    })(cc.Component);
o.default = l;
